<?php
/**
 * Base.php
 * Created by PhpStorm.
 * User: 江小波
 * Date: 2019/6/10
 * Time: 14:41
 */
namespace app\api\open;

abstract class Base
{
    protected $params = [];
    public function __construct($param=[])
    {
        if(empty($param))
        {
            $request = request();
            $this->params = $request->post();
        }else{
            $this->params = $param;
        }
    }

    /**
     * 阻止/api/index/index请求
     * @return bool
     */
    protected function prevent()
    {
        if(defined('IS_OPEN_API'))
        {
            throw new \Exception("UNKNOWN_INTERFACE");
        }
    }
}